home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / math / cephes22 / ieee / ieee.c < prev    next >
Encoding:
Text File  |  1992-11-16  |  43.8 KB  |  1,462 lines

  1.  := 0;
  2.       end;
  3.     end;
  4.   end;
  5.   WaitToGo;
  6. end; { UserLineStylePlay }
  7.  
  8.  
  9. procedure SayGoodbye;
  10. { Say goodbye and then exit the program }
  11. var
  12.   ViewInfo : ViewPortType;
  13. begin
  14.   MainWindow('');
  15.   GetViewSettings(ViewInfo);
  16.   SetTextStyle(TriplexFont, HorizDir, 4);
  17.   SetTextJustify(CenterText, CenterText);
  18.   with ViewInfo do
  19.     OutTextXY((x2-x1) div 2, (y2-y1) div 2, 'That''s all folks!');
  20.   StatusLine('Press any key to quit...');
  21.   repeat until KeyPressed;
  22. end; { SayGoodbye }
  23.  
  24.  
  25. PROCEDURE SelectMode;
  26. VAR
  27.     choice1,choice2     : CHAR;
  28.    xsize,ysize            : WORD;
  29. BEGIN
  30.     (* Let's select a mode *)
  31.     ClrScr;
  32.     WriteLn('VESADEMO:');
  33.     WriteLn('1. 256 colors');
  34.     WriteLn('2. 32768 colors');
  35.     WriteLn('3. 65536 colors');
  36.     WriteLn('4. 16777216 colors');
  37.     WriteLn('Q uit');
  38.     WriteLn;
  39.     Write('Your choice: ');
  40.     REPEAT
  41.         ReadLn(choice1);
  42.       IF choice1 <> '1' THEN BEGIN
  43.           WriteLn('Sorry !');
  44.          WriteLn('This demo wasn''t written for more as 256 colors !');
  45.          WriteLn('You would only get a limited impression of the Hi-& TrueColor modes...');
  46.          WriteLn('Switching to 256 colors.');
  47.          choice1 := '1';
  48.       END;
  49.     UNTIL choice1 IN ['1'..'4','q'];
  50.     IF choice1 = 'q' THEN Halt;
  51.  
  52.     WriteLn;
  53.     WriteLn;
  54.     WriteLn('a. 320x200');
  55.     WriteLn('b. 640x480');
  56.     WriteLn('c. 800x600');
  57.     WriteLn('d. 1024x768');
  58.     WriteLn('e. 1280x1024');
  59.     WriteLn('Q uit');
  60.     WriteLn;
  61.     Write('Your choice: ');
  62.     REPEAT
  63.         ReadLn(choice2);
  64.     UNTIL choice2 IN ['a'..'e','q'];
  65.     IF choice2 = 'q' THEN Halt;
  66.  
  67.     CASE choice2 OF
  68.         'a' : BEGIN
  69.             xsize := 320;
  70.             ysize := 200;
  71.         END;
  72.         'b' : BEGIN
  73.             xsize := 640;
  74.             ysize := 480;
  75.         END;
  76.         'c' : BEGIN
  77.             xsize := 800;
  78.             ysize := 600;
  79.         END;
  80.         'd' : BEGIN
  81.             xsize := 1024;
  82.             ysize := 768;
  83.         END;
  84.         'e' : BEGIN
  85.             xsize := 1280;
  86.             ysize := 1024;
  87.         END;
  88.     END;
  89.     CASE choice1 OF
  90.         '1' : mode := FindVesaMode(xsize,ysize,8);
  91.         '2' : mode := FindVesaMode(xsize,ysize,15);
  92.         '3' : mode := FindVesaMode(xsize,ysize,16);
  93.         '4' : mode := FindVesaMode(xsize,ysize,24);
  94.     END;
  95.     IF mode = 0 THEN BEGIN
  96.         WriteLn('No such mode could be found !');
  97.         WriteLn('Switching to to 320x200.');
  98.         ReadKey;
  99.         mode := V320x200x256;
  100.     END;
  101. END;
  102.  
  103. begin { program body }
  104.   SelectMode;
  105.   Initialize;
  106.   ReportStatus;
  107.  
  108. {  AspectRatioPlay; }
  109.   FillEllipsePlay;
  110.   SectorPlay;
  111.   WriteModePlay;
  112.  
  113.   ColorPlay;
  114.   { PalettePlay only intended to work on these drivers: }
  115.   if (GraphDriver = EGA) or
  116.       (GraphDriver = EGA64) or
  117.       (GraphDriver = VGA) then
  118.      PalettePlay;
  119.   PutPixelPlay;
  120. {  PutImagePlay; }
  121.   RandBarPlay;
  122.   BarPlay;
  123.   Bar3DPlay;
  124.   ArcPlay;
  125.   CirclePlay;
  126.   PiePlay;
  127.   LineToPlay;
  128.   LineRelPlay;
  129. {  LineStylePlay; }
  130. {  UserLineStylePlay; }
  131.   TextDump;
  132.   TextPlay;
  133.   CrtModePlay;
  134.   FillStylePlay;
  135.   FillPatternPlay;
  136.   PolyPlay;
  137.   SayGoodbye;
  138. {  CloseGraph; }
  139.   CloseVesa;
  140. end.
  141. ***************************************************
  142.     '* SHOW D2ROTATE (ABOUT THE ORIGIN)
  143.     '****************************************************************∞╥≤c≤*φè#^│v/╒:j═φ0t+l▓ô"¬"g└≡?%ªêΣ│H╫½╫╜├¿U'╒⌐⌡ ßV?╩
  144. ¬ujOΦçEZ1∞▐! ▄B╛Σ8║æ]1GlNÜ┐q▌▓;ô$ΦzE<cª*bEô#ä╧ñÅ"∩─LrdaÖ ╠º╫a^¥£å╬1~)@ëÖMδ╫0═6DäFê¬Çv┼ß╨kæpτ╪É)}ª 1w3╤╧ü⌡¥╓h▓╣≈ïÅaÑ[TⁿHqªÉ╝DKÄ─Y-∞tT╤Θ╨º╟╪.*ÇI9lΦ≈{πτcσ$τπßoFr╪╨∩┼╞╟;O2■e²LÜ4^N|╪½ÅO?╔°FOz`╟╟╟'<>>π$πΘù6·
  145. Xgî╖│°oîδπGƒd╝▀░?■╪╔_9L ⌡ôⁿq'æO▀ƒn4╔▀╚▄┼3pτ.òO°·}÷╕ⁿ±'æO?ít│!√8ßÑ≤/┐╣p┼≥┘E╦Vox╕cΦé5╟╚º╙$?√$≥ΘZεsî≡åìΓpKù¢ïß X╥ 9╞≈\µk┤O¥_ 5Üö\≤éÄ┌╤A[╤ÿáï┼éNⁿÅu16    g,%hc╙╨cD╨Vï┘R¢öKñR;8εáΣ╢╪ós╤π╡á└èxgzPÄMú╫yαºÉ+σJ¢i+▓â3╥    ═Ñ╙î^ºG▓█πérφçs %#(╗⌠?┼%u8≡6+QÉ))ò)Afw≈╣╪)B&4░åLXV:δät@Å.;5Φf╢Ät┐ΣJ╫─U8úÇ╟éö£╕p╔┴⌠vg╨╬╥é÷╪╣┬ΓI.ç≡^v╤ZΦÇ& ╒┌6ñô6XßNè╡╬E₧Ñ
  146. kIº╠▄A+╣╥éb²tæ-Y¡½αÑa═uuîÇ╢αêvhuª╡SÅ┤vèùú¥F;p<d⌐/F─d█éT%▓KΦû=q■öI┐ ┐╠6S$▒÷╚ENΩ¥Fû9╔┌R'╝ ╧φ└?g┬j▓0═/b╖₧─mûé╢┌»ÿÄë/·<éò■░╤╟╢├Xσ:╥P3Θ"╬Læsφ░┌öSö!╗¿*mN£WΣÇ£┤~#╗ææ≥RΩóh:à▌.æ≈╕▌v£äàd▒à╒├=░╖π║$howeg*╬    6ù▄ƒô╕φ░Ö╢qΘD>(w@úKεHÆ╛öúΣU
  147. éÜR╔╤W▄èê 2M%ó.▓SNÖA1ùJE╢║l]▓¿>\%└Å4ßO▄£â⌐& ê/)8vSP▀▓ôⁿææ√ü√ÑÄa⌠â╚4S╓╟P- ?Σá╕▓Næ*q╡UΘ▓≈^ñ·I.rúR&$Y^╚%è≡B┌≈Ceat
  148.     Color := RandColor;
  149.     SetColor(Color);
  150.     SetFillStyle(Random(CloseDotFill)+1, Color);
  151.     Bar3D(Random(MaxWidth), Random(MaxHeight),
  152.           Random(MaxWidth), Random(MaxHeight), 0, TopOff);
  153.   until KeyPressed;
  154.   WaitToGo;
  155. end; { RandBarPlay }
  156.  
  157. procedure ArcPlay;
  158. { Draw random arcs on the screen }
  159. var
  160.   MaxRadius : word;
  161.   EndAngle : word;
  162.   ArcInfo : ArcCoordsType;
  163. begin
  164.   MainWindow('Arc / GetArcCoords demonstration');
  165.   StatusLine('Esc aborts or press a key');
  166.   MaxRadius := MaxY div 10;
  167.   repeat
  168.     SetColor(RandColor);
  169.     EndAngle := Random(360);
  170.     SetLineStyle(SolidLn, 0, NormWidth);
  171.     Arc(Random(MaxX), Random(MaxY), Random(EndAngle), EndAngle, Random(MaxRadius));
  172.     GetArcCoords(ArcInfo);
  173.     with ArcInfo do
  174.     begin
  175.       Line(X, Y, XStart, YStart);
  176.       Line(X, Y, Xend, Yend);
  177.     end;
  178.   until KeyPressed;
  179.   WaitToGo;
  180. end; { ArcPlay }
  181.  
  182. procedure PutPixelPlay;
  183. { Demonstrate the PutPixel and GetPixel commands }
  184. const
  185.   Seed   = 1962; { A seed for the random number generator }
  186.   NumPts = 2000; { The number of pixels plotted }
  187.   Esc    = #27;
  188. var
  189.   I : word;
  190.   X, Y, Color : word;
  191.   XMax, YMax  : integer;
  192.   ViewInfo    : ViewPortType;
  193. begin
  194.   MainWindow('PutPixel / GetPixel demonstration');
  195.   StatusLine('Esc aborts or press a key...');
  196.  
  197.   GetViewSettings(ViewInfo);
  198.   with ViewInfo do
  199.   begin
  200.     XMax := (x2-x1-1);
  201.     YMax := (y2-y1-1);
  202.   end;
  203.  
  204.   while not KeyPressed do
  205.   begin
  206.     { Plot random pixels }
  207.     RandSeed := Seed;
  208.     I := 0;
  209.     while (not KeyPressed) and (I < NumPts) do
  210.     begin
  211.       Inc(I);
  212.         PutPixel(Random(XMax)+1, Random(YMax)+1, RandColor);
  213.     end;
  214.  
  215.     { Erase pixels }
  216.     RandSeed := Seed;
  217.     I := 0;
  218.     while (not KeyPressed) and (I < NumPts) do
  219.     begin
  220.       Inc(I);
  221.       X := Random(XMax)+1;
  222.       Y := Random(YMax)+1;
  223.       Color := GetPixel(X, Y);
  224.         if Color = RandColor then
  225.           PutPixel(X, Y, 0);
  226.      end;
  227.   end;
  228.   WaitToGo;
  229. end; { PutPixelPlay }
  230.  
  231. procedure PutImagePlay;
  232. { Demonstrate the GetImage and PutImage commands }
  233.  
  234. const
  235.   r  = 20;
  236.   StartX = 100;
  237.   StartY = 50;
  238.  
  239. var
  240.   CurPort : ViewPortType;
  241.  
  242. procedure MoveSaucer(var X, Y : integer; Width, Height : integer);
  243. var
  244.   Step : integer;
  245. begin
  246.   Step := Random(2*r);
  247.   if Odd(Step) then
  248.     Step := -Step;
  249.   X := X + Step;
  250.   Step := Random(r);
  251.   if Odd(Step) then
  252.     Step := -Step;
  253.   Y := Y + Step;
  254.  
  255.   { Make saucer bounce off viewport walls }
  256.   with CurPort do
  257.   begin
  258.     if (x1 + X + Width - 1 > x2) then
  259.       X := x2-x1 - Width + 1
  260.     else
  261.       if (X < 0) then
  262.         X := 0;
  263.     if (y1 + Y + Height - 1 > y2) then
  264.       Y := y2-y1 - Height + 1
  265.     else
  266.       if (Y < 0) then
  267.         Y := 0;
  268.   end;
  269. end; { MoveSaucer }
  270.  
  271. var
  272.   Pausetime : word;
  273.   Saucer    : pointer;
  274.   X, Y      : integer;
  275.   ulx, uly  : word;
  276.   lrx, lry  : word;
  277.   Size      : word;
  278.   I         : word;
  279. begin
  280.   ClearDevice;
  281.   FullPort;
  282.  
  283.   { PaintScreen }
  284.   ClearDevice;
  285.   MainWindow('GetImage / PutImage Demonstration');
  286.   StatusLine('Esc aborts or press a key...');
  287.   GetViewSettings(CurPort);
  288.  
  289.   { DrawSaucer }
  290.   Ellipse(StartX, StartY, 0, 360, r, (r div 3)+2);
  291.   Ellipse(StartX, StartY-4, 190, 357, r, r div 3);
  292.   Line(StartX+7, StartY-6, StartX+10, StartY-12);
  293.   Circle(StartX+10, StartY-12, 2);
  294.   Line(StartX-7, StartY-6, StartX-10, StartY-12);
  295.   Circle(StartX-10, StartY-12, 2);
  296.   SetFillStyle(SolidFill, MaxColor);
  297.   FloodFill(StartX+1, StartY+4, GetColor);
  298.  
  299.   { ReadSaucerImage }
  300.   ulx := StartX-(r+1);
  301.   uly := StartY-14;
  302.   lrx := StartX+(r+1);
  303.   lry := StartY+(r div 3)+3;
  304.  
  305.   Size := ImageSize(ulx, uly, lrx, lry);
  306.   GetMem(Saucer, Size);
  307.   GetImage(ulx, uly, lrx, lry, Saucer^);
  308. {  PutImage(ulx, uly, Saucer^, XORput);               { erase image }
  309.  
  310.   { Plot some "stars" }
  311.   for I := 1 to 1000 do
  312.      PutPixel(Random(MaxX), Random(MaxY), RandColor);
  313.   X := MaxX div 2;
  314.   Y := MaxY div 2;
  315.   PauseTime := 70;
  316.  
  317.   { Move the saucer around }
  318.   repeat
  319. {     PutImage(X, Y, Saucer^, XORput);                 { draw image }
  320.      Delay(PauseTime);
  321. {     PutImage(X, Y, Saucer^, XORput);                 { erase image }
  322.      MoveSaucer(X, Y, lrx - ulx + 1, lry - uly + 1);  { width/height }
  323.   until KeyPressed;
  324.   FreeMem(Saucer, size);
  325.   WaitToGo;
  326. end; { PutImagePlay }
  327.  
  328. procedure PolyPlay;
  329. { Draw random polygons with random fill styles on the screen }
  330. const
  331.   MaxPts = 5;
  332. type
  333.   PolygonType = array[1..MaxPts] of PointType;
  334. var
  335.   Poly : PolygonType;
  336.   I, Color : word;
  337. begin
  338.   MainWindow('FillPoly demonstration');
  339.   StatusLine('Esc aborts or press a key...');
  340.   repeat
  341.     Color := RandColor;
  342.     SetFillStyle(Random(11)+1, Color);
  343.     SetColor(Color);
  344.     for I := 1 to MaxPts do
  345.       with Poly[I] do
  346.       begin
  347.         X := Random(MaxX);
  348.         Y := Random(MaxY);
  349.       end;
  350.     FillPoly(MaxPts, Poly);
  351.   until KeyPressed;
  352.   WaitToGo;
  353. end; { PolyPlay }
  354.  
  355. procedure FillStylePlay;
  356. { Display all of the predefined fill styles available }
  357. var
  358.   Style    : word;
  359.   Width    : word;
  360.   Height   : word;
  361.   X, Y     : word;
  362.   I, J     : word;
  363.   ViewInfo : ViewPortType;
  364.  
  365. procedure DrawBox(X, Y : word);
  366. begin
  367.   SetFillStyle(Style, MaxColor);
  368.   with ViewInfo do
  369.     Bar(X, Y, X+Width, Y+Height);
  370.   Rectangle(X, Y, X+Width, Y+Height);
  371.   OutTextXY(X+(Width div 2), Y+Height+4, Int2Str(Style));
  372.   Inc(Style);
  373. end; { DrawBox }
  374.  
  375. begin
  376.   MainWindow('Pre-defined fill styles');
  377.   GetViewSettings(ViewInfo);
  378.   with ViewInfo do
  379.   begin
  380.     Width := 2 * ((x2+1) div 13);
  381.     Height := 2 * ((y2-10) div 10);
  382.   end;
  383.   X := Width div 2;
  384.   Y := Height div 2;
  385.   Style := 0;
  386.   for J := 1 to 3 do
  387.   begin
  388.     for I := 1 to 4 do
  389.     begin
  390.       DrawBox(X, Y);
  391.       Inc(X, (Width div 2) * 3);
  392.     end;
  393.     X := Width div 2;
  394.     Inc(Y, (Height div 2) * 3);
  395.   end;
  396.   SetTextJustify(LeftText, TopText);
  397.   WaitToGo;
  398. end; { FillStylePlay }
  399.  
  400. procedure FillPatternPlay;
  401. { Display some user defined fill patterns }
  402. const
  403.   Patterns : array[0..11] of FillPatternType = (
  404.   ($AA, $55, $AA, $55, $AA, $55, $AA, $55 üÖü üÖü  !BBäx!!!BBäx!BBäx"""DDêp""DDêp>"""BBääêp""!"BDäêêp>IÉÆ|      ° @≥î>00>><Dêx  !BBäx""DDêp&<"DDêê&22TTêêê$> $< @äêp>          ⁿBBBB<  @@Ç****DDDDDDDU¬U¬U¬U¬U¬U¬U¬▌w▌w▌w▌w▌w▌w▌w°°°≥■°°≥≥■≥≥■■°°°    ≤  ≤  ≤≤         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       ;DDD;    $"Bdÿ>@@@>||>Ac]AAA1N"A""2,  `1NA"*III*<Bü üB<<BüüüB<A" \"QIE" < <BBBB  @@    ~ ?  @ÇB$$B ""A$$"AII6 üBr»$**IIII**ccregion.  The region is defined as any pixel of
  405.             OldColor which has a path of pixels of OldColor or NewColor
  406.             with sides touching back to the seed point, (XSeed, YSeed).
  407.             Therefore, only pixels of OldColor are modified and no other
  408.             information is changed.
  409.  
  410.             SEE ALSO
  411.  
  412.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  413.             FILLCONVEXPOLY, FILLPAGE, FILLPOLY, FILLSCREEN, FILLVIEW,
  414.             SETVIEW
  415.  
  416.             EXAMPL(HNxHHO$B<BBBB<$<BBBB<<BBBB<$BBBBBF:0BBBBF:$BBBF:B<""AAA""AAAAA"<B@@B<" <2\A">>xDDxDNDD <` <>BB= > <BBBB< BBBBF:2L\bBBBB&AaQIECA8$>""">0@@A>@@@ b$(. b$(*
  417.     $    $    $DDDDDDD¬U¬U¬U¬U¬U¬U¬Uw▌w▌w▌w▌w▌w▌w▌°°°⌠ⁿ°°⌠⌠ⁿ⌠⌠ⁿⁿ°°°    ≈  ≈  ≈≈         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       7HH7"B\DBBRL~BB@@@@@@?R~!!~?DDDD8BBBB|@@Ç>P>III>"AA""AAA"Uw<DDDD86II6"EIQ"\ @@ "AAAAA> >     hH02L2L$$<H(,$<>>>>>>>         VMODE=VIDEOMODEGET
  418.             IF WHICHVGA = 0 THEN STOP
  419.             DUMMY=RES640
  420.             SETVIEW 100, 100, 539, 379
  421.             FILLVIEW 10
  422.             WHILE INKEY$ = ""
  423.             WEND
  424.             VIDEOMODESET VMODE
  425.             END
  426.  
  427.  
  428.  
  429.  
  430.  
  431.  
  432.  
  433.  
  434.  
  435.  
  436.  
  437.  
  438.  
  439.  
  440.  
  441.  
  442.                                                                          63
  443.  
  444.  
  445.  
  446.  
  447.  
  448.  
  449.           FONTGETINFO
  450.  
  451.             PROTOTYPE
  452.  
  453.             SUB FONTGETINFO (Width%, Height%)
  454.  
  455.             INPUT
  456.  
  457.             no input parameters
  458.     WEND
  459.             MOUSEEXIT
  460.             VIDEOMODESET VMODE
  461.             END
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468.  
  469.  
  470.  
  471.  
  472.  
  473.  
  474.  
  475.  
  476.  
  477.  
  478.  
  479.  
  480.  
  481.  
  482.  
  483.  
  484.  
  485.  
  486.  
  487.  
  488.  
  489.  
  490.  
  491.  
  492.  
  493.  
  494.  
  495.  
  496.  
  497.  
  498.  
  499.  
  500.  
  501.  
  502.                                                                          86
  503.  
  504.  
  505.  
  506.  
  507.  
  508.  
  509.           MOUSECURSORDEFAULT
  510.  
  511.             PROTOTYPE
  512.  
  513.             SUB MOUSECURSORDEFAULT ()
  514.  
  515.             INPUT
  516.  
  517.             no input parameters
  518.  
  519.             OUTPUT
  520.  
  521.             no value returned
  522.  
  523.             USAGE
  524.  
  525.             MOUSECURSORDEFAULT defines the mouse cursor to be a small
  526.        ,K$╖┼╘╤░XQ)σ┤ö≡÷┴─┤àñT┘,╘¬àñX9╘⌠àñ\9╘UÜ╢≤`9╘4a╘d9╘UTa╘h9╘ta╘l9╘Uöa╘p9╘┤a╘t┘PT±x┴îÇ╖0▓ïα│ÅαU┤ôα╡ùα╢¢α╖úΓ╘pǺΓ╕¡αë ╚┴πì°sKÉφb<$⌡▌ë     φë φë I1φë  Eφë $YφÆë (mφë ,üφë 0$òφë á⌐φë ñ╜φë I¿╤φë ¼σφë ░∙φÆë 4
  527. ²ë ┤!²ë ╕$5²ë ╝I²ë └]²ë ⌐8q²ë <àⁿΦiǬ∙PÖÇ ¥Ç
  528. ░╨â@%8@ΓΦá╝╤░≡cÑÅ*$
  529. ░╕≡ż≡τ╥m¿⌡ε    ╨@#µ≈$âh$âαra╨à`¥è∩Ç%Ç +─▀ TîcOî∩â°1<@  [$¿Ç¼ MMl·0ƒ Y¼─!%6a▐è ¥ì ßá+?±  P<îaTTV ╪iÇ¡≥░ `_ñ»%Çá᪠P█º»ε`éa∙É%H«┴íA%Gár∙É
  530. iw∙Éiφ`╧≥≡╤Çmⁿ▒
  531. ]ÆAáσw7░⌡∩    $·╟Ç√É&^`  ┐ $ⁿ  $■ $╒ nk$J-ÉQ1£PéBù »0αQ/Ñ4╜£░ºP≈Ñ4Ç⌡$(ª▀$@C]Æé≈└╕_SÇçÑ4=iÉ⌠ä╣<_np@Ñ45ò▒Y3ü¼Qí░.i>╠@5+┴╙É╛╙$@ #┴@«╦
  532. $╤
  533. #@Ñú4,p&e÷ü¼_ÇQºÑ4
  534. òQ  ü@;¡_áQ@e╠≥@mp!┤a╘O░√`Pñź ÇT°8ÿ!¼Åñ$½╙"q¿ PñCÇ¿α√└╥░eT"ß<p°%Pæ(╧%pδ¥/OêW0Ǽbφ φ B@[â¼8â≥µ≤(    ¿⌡%(Ç∩áTÿp+ óÜ▓0!Σ±(1±
  535. ░┤ÖÇD└D0Å╡`   $ «îO@╧1
  536. a╝╤j-0ñ│`@╖bΦaT1═⌠╝╤Σ²¼±,1öíî9lÿ28ÇÅ`Γî¿P²$,N0┴O0a╫δ≤0σú`°î╖#0δ≡└X▄1»Σî(▒¥Ç█Ñ"qá√1CÇú╟╨º Å
  537. FT Θ²î└1ÇY0    w ²à░$@AÅ`╦Φ¼╘`▄1A  }┐Ç*5 ΩSδδî`¼îaδæ¼î5 1¿⌡Ω╜⌠ ¼¥╬ü└Qî1S
  538. ╛≤î9╨iÇ,∙PU(}Ç$üÇ àÇ`σìÇ`QαÜBO$%ÿÇ╧"$Ç«Ç]É.┬\`%WÉ$  W0 ÄâO0]αG┬ur╩
  539. ░£▒
  540. Q¢ú╔Ç≡°s?`X0╘`@ µWâ@╣aá εdq`¥9?Ç&+o0µyÄΣAÅuV(7P╬±@IdQ╕@Å┤@;Ç▓?Çò│CÇ┤╟╨╡KÇÄ30ⁿφ° ó╬ì+]Ä╦≡     Mö╝σ ²y5<!└▀óâ╝É3~mp    $<╛≤9Æ-2ⁿ≡@T,╞Σa,)Pæ└¥#¼╪Q┤S(¼@Aîa
  541. ≡╤@Ö²±⌠KëD─┴▒▀0╨Ñ$╩-0 ╨ê*╙▓edm`î=3Kß-10è=≥≤²└£mîjy ÿe²ⁿ╨i╕e▓ΣmαÖ╢C%Ç*ê*0 EátQZ`mÄLP%    °üⁿªüNQ∙  T¿<qtWΩc z░ÅÇñΩçǪçÇ«;└<┐á¼¥. á?<Σscî)áí := 0;
  542.       end;
  543.     end;
  544.   end;
  545.   WaitToGo;
  546. end; { UserLineStylePlay }
  547.  
  548.  
  549. procedure SayGoodbye;
  550. { Say goodbye and then exit the program }
  551. var
  552.   ViewInfo : ViewPortType;
  553. begin
  554.   MainWindow('');
  555.   GetViewSettings(ViewInfo);
  556.   SetTextStyle(TriplexFont, HorizDir, 4);
  557.   SetTextJustify(CenterText, CenterText);
  558.   with ViewInfo do
  559.     OutTextXY((x2-x1) div 2, (y2-y1) div 2, 'That''s all folks!');
  560.   StatusLine('Press any key to quit...');
  561.   repeat until KeyPressed;
  562. end; { SayGoodbye }
  563.  
  564.  
  565. PROCEDURE SelectMode;
  566. VAR
  567.     choice1,choice2     : CHAR;
  568.    xsize,ysize            : WORD;
  569. BEGIN
  570.     (* Let's select a mode *)
  571.     ClrScr;
  572.     WriteLn('VESADEMO:');
  573.     WriteLn('1. 256 colors');
  574.     WriteLn('2. 32768 colors');
  575.     WriteLn('3. 65536 colors');
  576.     WriteLn('4. 16777216 colors');
  577.     WriteLn('Q uit');
  578.     WriteLn;
  579.     Write('Your choice: ');
  580.     REPEAT
  581.         ReadLn(choice1);
  582.       IF choice1 <> '1' THEN BEGIN
  583.           WriteLn('Sorry !');
  584.          WriteLn('This demo wasn''t written for more as 256 colors !');
  585.          WriteLn('You would only get a limited impression of the Hi-& TrueColor modes...');
  586.          WriteLn('Switching to 256 colors.');
  587.          choice1 := '1';
  588.       END;
  589.     UNTIL choice1 IN ['1'..'4','q'];
  590.     IF choice1 = 'q' THEN Halt;
  591.  
  592.     WriteLn;
  593.     WriteLn;
  594.     WriteLn('a. 320x200');
  595.     WriteLn('b. 640x480');
  596.     WriteLn('c. 800x600');
  597.     WriteLn('d. 1024x768');
  598.     WriteLn('e. 1280x1024');
  599.     WriteLn('Q uit');
  600.     WriteLn;
  601.     Write('Your choice: ');
  602.     REPEAT
  603.         ReadLn(choice2);
  604.     UNTIL choice2 IN ['a'..'e','q'];
  605.     IF choice2 = 'q' THEN Halt;
  606.  
  607.     CASE choice2 OF
  608.         'a' : BEGIN
  609.             xsize := 320;
  610.             ysize := 200;
  611.         END;
  612.         'b' : BEGIN
  613.             xsize := 640;
  614.             ysize := 480;
  615.         END;
  616.         'c' : BEGIN
  617.             xsize := 800;
  618.             ysize := 600;
  619.         END;
  620.         'd' : BEGIN
  621.             xsize := 1024;
  622.             ysize := 768;
  623.         END;
  624.         'e' : BEGIN
  625.             xsize := 1280;
  626.             ysize := 1024;
  627.         END;
  628.     END;
  629.     CASE choice1 OF
  630.         '1' : mode := FindVesaMode(xsize,ysize,8);
  631.         '2' : mode := FindVesaMode(xsize,ysize,15);
  632.         '3' : mode := FindVesaMode(xsize,ysize,16);
  633.         '4' : mode := FindVesaMode(xsize,ysize,24);
  634.     END;
  635.     IF mode = 0 THEN BEGIN
  636.         WriteLn('No such mode could be found !');
  637.         WriteLn('Switching to to 320x200.');
  638.         ReadKey;
  639.         mode := V320x200x256;
  640.     END;
  641. END;
  642.  
  643. begin { program body }
  644.   SelectMode;
  645.   Initialize;
  646.   ReportStatus;
  647.  
  648. {  AspectRatioPlay; }
  649.   FillEllipsePlay;
  650.   SectorPlay;
  651.   WriteModePlay;
  652.  
  653.   ColorPlay;
  654.   { PalettePlay only intended to work on these drivers: }
  655.   if (GraphDriver = EGA) or
  656.       (GraphDriver = EGA64) or
  657.       (GraphDriver = VGA) then
  658.      PalettePlay;
  659.   PutPixelPlay;
  660. {  PutImagePlay; }
  661.   RandBarPlay;
  662.   BarPlay;
  663.   Bar3DPlay;
  664.   ArcPlay;
  665.   CirclePlay;
  666.   PiePlay;
  667.   LineToPlay;
  668.   LineRelPlay;
  669. {  LineStylePlay; }
  670. {  UserLineStylePlay; }
  671.   TextDump;
  672.   TextPlay;
  673.   CrtModePlay;
  674.   FillStylePlay;
  675.   FillPatternPlay;
  676.   PolyPlay;
  677.   SayGoodbye;
  678. {  CloseGraph; }
  679.   CloseVesa;
  680. end.
  681. ***************************************************
  682.     '* SHOW D2ROTATE (ABOUT THE ORIGIN)
  683.     '****************************************************************∞╥≤c≤*φè#^│v/╒:j═φ0t+l▓ô"¬"g└≡?%ªêΣ│H╫½╫╜├¿U'╒⌐⌡ ßV?╩
  684. ¬ujOΦçEZ1∞▐! ▄B╛Σ8║æ]1GlNÜ┐q▌▓;ô$ΦzE<cª*bEô#ä╧ñÅ"∩─LrdaÖ ╠º╫a^¥£å╬1~)@ëÖMδ╫0═6DäFê¬Çv┼ß╨kæpτ╪É)}ª 1w3╤╧ü⌡¥╓h▓╣≈ïÅaÑ[TⁿHqªÉ╝DKÄ─Y-∞tT╤Θ╨º╟╪.*ÇI9lΦ≈{πτcσ$τπßoFr╪╨∩┼╞╟;O2■e²LÜ4^N|╪½ÅO?╔°FOz`╟╟╟'<>>π$πΘù6·
  685. Xgî╖│°oîδπGƒd╝▀░?■╪╔_9L ⌡ôⁿq'æO▀ƒn4╔▀╚▄┼3pτ.òO°·}÷╕ⁿ±'æO?ít│!√8ßÑ≤/┐╣p┼≥┘E╦Vox╕cΦé5╟╚º╙$?√$≥ΘZεsî≡åìΓpKù¢ïß X╥ 9╞≈\µk┤O¥_ 5Üö\≤éÄ┌╤A[╤ÿáï┼éNⁿÅu16    g,%hc╙╨cD╨Vï┘R¢öKñR;8εáΣ╢╪ós╤π╡á└èxgzPÄMú╫yαºÉ+σJ¢i+▓â3╥    ═Ñ╙î^ºG▓█πérφçs %#(╗⌠?┼%u8≡6+QÉ))ò)Afw≈╣╪)B&4░åLXV:δät@Å.;5Φf╢Ät┐ΣJ╫─U8úÇ╟éö£╕p╔┴⌠vg╨╬╥é÷╪╣┬ΓI.ç≡^v╤ZΦÇ& ╒┌6ñô6XßNè╡╬E₧Ñ
  686. kIº╠▄A+╣╥éb²tæ-Y¡½αÑa═uuîÇ╢αêvhuª╡SÅ┤vèùú¥F;p<d⌐/F─d█éT%▓KΦû=q■öI┐ ┐╠6S$▒÷╚ENΩ¥Fû9╔┌R'╝ ╧φ└?g┬j▓0═/b╖₧─mûé╢┌»ÿÄë/·<éò■░╤╟╢├Xσ:╥P3Θ"╬Læsφ░┌öSö!╗¿*mN£WΣÇ£┤~#╗ææ≥RΩóh:à▌.æ≈╕▌v£äàd▒à╒├=░╖π║$howeg*╬    6ù▄ƒô╕φ░Ö╢qΘD>(w@úKεHÆ╛öúΣU
  687. éÜR╔╤W▄èê 2M%ó.▓SNÖA1ùJE╢║l]▓¿>\%└Å4ßO▄£â⌐& ê/)8vSP▀▓ôⁿææ√ü√ÑÄa⌠â╚4S╓╟P- ?Σá╕▓Næ*q╡UΘ▓≈^ñ·I.rúR&$Y^╚%è≡B┌≈Ceat
  688.     Color := RandColor;
  689.     SetColor(Color);
  690.     SetFillStyle(Random(CloseDotFill)+1, Color);
  691.     Bar3D(Random(MaxWidth), Random(MaxHeight),
  692.           Random(MaxWidth), Random(MaxHeight), 0, TopOff);
  693.   until KeyPressed;
  694.   WaitToGo;
  695. end; { RandBarPlay }
  696.  
  697. procedure ArcPlay;
  698. { Draw random arcs on the screen }
  699. var
  700.   MaxRadius : word;
  701.   EndAngle : word;
  702.   ArcInfo : ArcCoordsType;
  703. begin
  704.   MainWindow('Arc / GetArcCoords demonstration');
  705.   StatusLine('Esc aborts or press a key');
  706.   MaxRadius := MaxY div 10;
  707.   repeat
  708.     SetColor(RandColor);
  709.     EndAngle := Random(360);
  710.     SetLineStyle(SolidLn, 0, NormWidth);
  711.     Arc(Random(MaxX), Random(MaxY), Random(EndAngle), EndAngle, Random(MaxRadius));
  712.     GetArcCoords(ArcInfo);
  713.     with ArcInfo do
  714.     begin
  715.       Line(X, Y, XStart, YStart);
  716.       Line(X, Y, Xend, Yend);
  717.     end;
  718.   until KeyPressed;
  719.   WaitToGo;
  720. end; { ArcPlay }
  721.  
  722. procedure PutPixelPlay;
  723. { Demonstrate the PutPixel and GetPixel commands }
  724. const
  725.   Seed   = 1962; { A seed for the random number generator }
  726.   NumPts = 2000; { The number of pixels plotted }
  727.   Esc    = #27;
  728. var
  729.   I : word;
  730.   X, Y, Color : word;
  731.   XMax, YMax  : integer;
  732.   ViewInfo    : ViewPortType;
  733. begin
  734.   MainWindow('PutPixel / GetPixel demonstration');
  735.   StatusLine('Esc aborts or press a key...');
  736.  
  737.   GetViewSettings(ViewInfo);
  738.   with ViewInfo do
  739.   begin
  740.     XMax := (x2-x1-1);
  741.     YMax := (y2-y1-1);
  742.   end;
  743.  
  744.   while not KeyPressed do
  745.   begin
  746.     { Plot random pixels }
  747.     RandSeed := Seed;
  748.     I := 0;
  749.     while (not KeyPressed) and (I < NumPts) do
  750.     begin
  751.       Inc(I);
  752.         PutPixel(Random(XMax)+1, Random(YMax)+1, RandColor);
  753.     end;
  754.  
  755.     { Erase pixels }
  756.     RandSeed := Seed;
  757.     I := 0;
  758.     while (not KeyPressed) and (I < NumPts) do
  759.     begin
  760.       Inc(I);
  761.       X := Random(XMax)+1;
  762.       Y := Random(YMax)+1;
  763.       Color := GetPixel(X, Y);
  764.         if Color = RandColor then
  765.           PutPixel(X, Y, 0);
  766.      end;
  767.   end;
  768.   WaitToGo;
  769. end; { PutPixelPlay }
  770.  
  771. procedure PutImagePlay;
  772. { Demonstrate the GetImage and PutImage commands }
  773.  
  774. const
  775.   r  = 20;
  776.   StartX = 100;
  777.   StartY = 50;
  778.  
  779. var
  780.   CurPort : ViewPortType;
  781.  
  782. procedure MoveSaucer(var X, Y : integer; Width, Height : integer);
  783. var
  784.   Step : integer;
  785. begin
  786.   Step := Random(2*r);
  787.   if Odd(Step) then
  788.     Step := -Step;
  789.   X := X + Step;
  790.   Step := Random(r);
  791.   if Odd(Step) then
  792.     Step := -Step;
  793.   Y := Y + Step;
  794.  
  795.   { Make saucer bounce off viewport walls }
  796.   with CurPort do
  797.   begin
  798.     if (x1 + X + Width - 1 > x2) then
  799.       X := x2-x1 - Width + 1
  800.     else
  801.       if (X < 0) then
  802.         X := 0;
  803.     if (y1 + Y + Height - 1 > y2) then
  804.       Y := y2-y1 - Height + 1
  805.     else
  806.       if (Y < 0) then
  807.         Y := 0;
  808.   end;
  809. end; { MoveSaucer }
  810.  
  811. var
  812.   Pausetime : word;
  813.   Saucer    : pointer;
  814.   X, Y      : integer;
  815.   ulx, uly  : word;
  816.   lrx, lry  : word;
  817.   Size      : word;
  818.   I         : word;
  819. begin
  820.   ClearDevice;
  821.   FullPort;
  822.  
  823.   { PaintScreen }
  824.   ClearDevice;
  825.   MainWindow('GetImage / PutImage Demonstration');
  826.   StatusLine('Esc aborts or press a key...');
  827.   GetViewSettings(CurPort);
  828.  
  829.   { DrawSaucer }
  830.   Ellipse(StartX, StartY, 0, 360, r, (r div 3)+2);
  831.   Ellipse(StartX, StartY-4, 190, 357, r, r div 3);
  832.   Line(StartX+7, StartY-6, StartX+10, StartY-12);
  833.   Circle(StartX+10, StartY-12, 2);
  834.   Line(StartX-7, StartY-6, StartX-10, StartY-12);
  835.   Circle(StartX-10, StartY-12, 2);
  836.   SetFillStyle(SolidFill, MaxColor);
  837.   FloodFill(StartX+1, StartY+4, GetColor);
  838.  
  839.   { ReadSaucerImage }
  840.   ulx := StartX-(r+1);
  841.   uly := StartY-14;
  842.   lrx := StartX+(r+1);
  843.   lry := StartY+(r div 3)+3;
  844.  
  845.   Size := ImageSize(ulx, uly, lrx, lry);
  846.   GetMem(Saucer, Size);
  847.   GetImage(ulx, uly, lrx, lry, Saucer^);
  848. {  PutImage(ulx, uly, Saucer^, XORput);               { erase image }
  849.  
  850.   { Plot some "stars" }
  851.   for I := 1 to 1000 do
  852.      PutPixel(Random(MaxX), Random(MaxY), RandColor);
  853.   X := MaxX div 2;
  854.   Y := MaxY div 2;
  855.   PauseTime := 70;
  856.  
  857.   { Move the saucer around }
  858.   repeat
  859. {     PutImage(X, Y, Saucer^, XORput);                 { draw image }
  860.      Delay(PauseTime);
  861. {     PutImage(X, Y, Saucer^, XORput);                 { erase image }
  862.      MoveSaucer(X, Y, lrx - ulx + 1, lry - uly + 1);  { width/height }
  863.   until KeyPressed;
  864.   FreeMem(Saucer, size);
  865.   WaitToGo;
  866. end; { PutImagePlay }
  867.  
  868. procedure PolyPlay;
  869. { Draw random polygons with random fill styles on the screen }
  870. const
  871.   MaxPts = 5;
  872. type
  873.   PolygonType = array[1..MaxPts] of PointType;
  874. var
  875.   Poly : PolygonType;
  876.   I, Color : word;
  877. begin
  878.   MainWindow('FillPoly demonstration');
  879.   StatusLine('Esc aborts or press a key...');
  880.   repeat
  881.     Color := RandColor;
  882.     SetFillStyle(Random(11)+1, Color);
  883.     SetColor(Color);
  884.     for I := 1 to MaxPts do
  885.       with Poly[I] do
  886.       begin
  887.         X := Random(MaxX);
  888.         Y := Random(MaxY);
  889.       end;
  890.     FillPoly(MaxPts, Poly);
  891.   until KeyPressed;
  892.   WaitToGo;
  893. end; { PolyPlay }
  894.  
  895. procedure FillStylePlay;
  896. { Display all of the predefined fill styles available }
  897. var
  898.   Style    : word;
  899.   Width    : word;
  900.   Height   : word;
  901.   X, Y     : word;
  902.   I, J     : word;
  903.   ViewInfo : ViewPortType;
  904.  
  905. procedure DrawBox(X, Y : word);
  906. begin
  907.   SetFillStyle(Style, MaxColor);
  908.   with ViewInfo do
  909.     Bar(X, Y, X+Width, Y+Height);
  910.   Rectangle(X, Y, X+Width, Y+Height);
  911.   OutTextXY(X+(Width div 2), Y+Height+4, Int2Str(Style));
  912.   Inc(Style);
  913. end; { DrawBox }
  914.  
  915. begin
  916.   MainWindow('Pre-defined fill styles');
  917.   GetViewSettings(ViewInfo);
  918.   with ViewInfo do
  919.   begin
  920.     Width := 2 * ((x2+1) div 13);
  921.     Height := 2 * ((y2-10) div 10);
  922.   end;
  923.   X := Width div 2;
  924.   Y := Height div 2;
  925.   Style := 0;
  926.   for J := 1 to 3 do
  927.   begin
  928.     for I := 1 to 4 do
  929.     begin
  930.       DrawBox(X, Y);
  931.       Inc(X, (Width div 2) * 3);
  932.     end;
  933.     X := Width div 2;
  934.     Inc(Y, (Height div 2) * 3);
  935.   end;
  936.   SetTextJustify(LeftText, TopText);
  937.   WaitToGo;
  938. end; { FillStylePlay }
  939.  
  940. procedure FillPatternPlay;
  941. { Display some user defined fill patterns }
  942. const
  943.   Patterns : array[0..11] of FillPatternType = (
  944.   ($AA, $55, $AA, $55, $AA, $55, $AA, $55 üÖü üÖü  !BBäx!!!BBäx!BBäx"""DDêp""DDêp>"""BBääêp""!"BDäêêp>IÉÆ|      ° @≥î>00>><Dêx  !BBäx""DDêp&<"DDêê&22TTêêê$> $< @äêp>          ⁿBBBB<  @@Ç****DDDDDDDU¬U¬U¬U¬U¬U¬U¬▌w▌w▌w▌w▌w▌w▌w°°°≥■°°≥≥■≥≥■■°°°    ≤  ≤  ≤≤         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       ;DDD;    $"Bdÿ>@@@>||>Ac]AAA1N"A""2,  `1NA"*III*<Bü üB<<BüüüB<A" \"QIE" < <BBBB  @@    ~ ?  @ÇB$$B ""A$$"AII6 üBr»$**IIII**ccregion.  The region is defined as any pixel of
  945.             OldColor which has a path of pixels of OldColor or NewColor
  946.             with sides touching back to the seed point, (XSeed, YSeed).
  947.             Therefore, only pixels of OldColor are modified and no other
  948.             information is changed.
  949.  
  950.             SEE ALSO
  951.  
  952.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  953.             FILLCONVEXPOLY, FILLPAGE, FILLPOLY, FILLSCREEN, FILLVIEW,
  954.             SETVIEW
  955.  
  956.             EXAMPL(HNxHHO$B<BBBB<$<BBBB<<BBBB<$BBBBBF:0BBBBF:$BBBF:B<""AAA""AAAAA"<B@@B<" <2\A">>xDDxDNDD <` <>BB= > <BBBB< BBBBF:2L\bBBBB&AaQIECA8$>""">0@@A>@@@ b$(. b$(*
  957.     $    $    $DDDDDDD¬U¬U¬U¬U¬U¬U¬Uw▌w▌w▌w▌w▌w▌w▌°°°⌠ⁿ°°⌠⌠ⁿ⌠⌠ⁿⁿ°°°    ≈  ≈  ≈≈         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       7HH7"B\DBBRL~BB@@@@@@?R~!!~?DDDD8BBBB|@@Ç>P>III>"AA""AAA"Uw<DDDD86II6"EIQ"\ @@ "AAAAA> >     hH02L2L$$<H(,$<>>>>>>>         VMODE=VIDEOMODEGET
  958.             IF WHICHVGA = 0 THEN STOP
  959.             DUMMY=RES640
  960.             SETVIEW 100, 100, 539, 379
  961.             FILLVIEW 10
  962.             WHILE INKEY$ = ""
  963.             WEND
  964.             VIDEOMODESET VMODE
  965.             END
  966.  
  967.  
  968.  
  969.  
  970.  
  971.  
  972.  
  973.  
  974.  
  975.  
  976.  
  977.  
  978.  
  979.  
  980.  
  981.  
  982.                                                                          63
  983.  
  984.  
  985.  
  986.  
  987.  
  988.  
  989.           FONTGETINFO
  990.  
  991.             PROTOTYPE
  992.  
  993.             SUB FONTGETINFO (Width%, Height%)
  994.  
  995.             INPUT
  996.  
  997.             no input parameters
  998.     WEND
  999.             MOUSEEXIT
  1000.             VIDEOMODESET VMODE
  1001.             END
  1002.  
  1003.  
  1004.  
  1005.  
  1006.  
  1007.  
  1008.  
  1009.  
  1010.  
  1011.  
  1012.  
  1013.  
  1014.  
  1015.  
  1016.  
  1017.  
  1018.  
  1019.  
  1020.  
  1021.  
  1022.  
  1023.  
  1024.  
  1025.  
  1026.  
  1027.  
  1028.  
  1029.  
  1030.  
  1031.  
  1032.  
  1033.  
  1034.  
  1035.  
  1036.  
  1037.  
  1038.  
  1039.  
  1040.  
  1041.  
  1042.                                                                          86
  1043.  
  1044.  
  1045.  
  1046.  
  1047.  
  1048.  
  1049.           MOUSECURSORDEFAULT
  1050.  
  1051.             PROTOTYPE
  1052.  
  1053.             SUB MOUSECURSORDEFAULT ()
  1054.  
  1055.             INPUT
  1056.  
  1057.             no input parameters
  1058.  
  1059.             OUTPUT
  1060.  
  1061.             no value returned
  1062.  
  1063.             USAGE
  1064.  
  1065.             MOUSECURSORDEFAULT defines the mouse cursor to be a small
  1066.        ,K$╖┼╘╤░XQ)σ┤ö≡÷┴─┤àñT┘,╘¬àñX9╘⌠àñ\9╘UÜ╢≤`9╘4a╘d9╘UTa╘h9╘ta╘l9╘Uöa╘p9╘┤a╘t┘PT±x┴îÇ╖0▓ïα│ÅαU┤ôα╡ùα╢¢α╖úΓ╘pǺΓ╕¡αë ╚┴πì°sKÉφb<$⌡▌ë     φë φë I1φë  Eφë $YφÆë (mφë ,üφë 0$òφë á⌐φë ñ╜φë I¿╤φë ¼σφë ░∙φÆë 4
  1067. ²ë ┤!²ë ╕$5²ë ╝I²ë └]²ë ⌐8q²ë <àⁿΦiǬ∙PÖÇ ¥Ç
  1068. ░╨â@%8@ΓΦá╝╤░≡cÑÅ*$
  1069. ░╕≡ż≡τ╥m¿⌡ε    ╨@#µ≈$âh$âαra╨à`¥è∩Ç%Ç +─▀ TîcOî∩â°1<@  [$¿Ç¼ MMl·0ƒ Y¼─!%6a▐è ¥ì ßá+?±  P<îaTTV ╪iÇ¡≥░ `_ñ»%Çá᪠P█º»ε`éa∙É%H«┴íA%Gár∙É
  1070. iw∙Éiφ`╧≥≡╤Çmⁿ▒
  1071. ]ÆAáσw7░⌡∩    $·╟Ç√É&^`  ┐ $ⁿ  $■ $╒ nk$J-ÉQ1£PéBù »0αQ/Ñ4╜£░ºP≈Ñ4Ç⌡$(ª▀$@C]Æé≈└╕_SÇçÑ4=iÉ⌠ä╣<_np@Ñ45ò▒Y3ü¼Qí░.i>╠@5+┴╙É╛╙$@ #┴@«╦
  1072. $╤
  1073. #@Ñú4,p&e÷ü¼_ÇQºÑ4
  1074. òQ  ü@;¡_áQ@e╠≥@mp!┤a╘O░√`Pñź ÇT°8ÿ!¼Åñ$½╙"q¿ PñCÇ¿α√└╥░eT"ß<p°%Pæ(╧%pδ¥/OêW0Ǽbφ φ B@[â¼8â≥µ≤(    ¿⌡%(Ç∩áTÿp+ óÜ▓0!Σ±(1±
  1075. ░┤ÖÇD└D0Å╡`   $ «îO@╧1
  1076. a╝╤j-0ñ│`@╖bΦaT1═⌠╝╤Σ²¼±,1öíî9lÿ28ÇÅ`Γî¿P²$,N0┴O0a╫δ≤0σú`°î╖#0δ≡└X▄1»Σî(▒¥Ç█Ñ"qá√1CÇú╟╨º Å
  1077. FT Θ²î└1ÇY0    w ²à░$@AÅ`╦Φ¼╘`▄1A  }┐Ç*5 ΩSδδî`¼îaδæ¼î5 1¿⌡Ω╜⌠ ¼¥╬ü└Qî1S
  1078. ╛≤î9╨iÇ,∙PU(}Ç$üÇ àÇ`σìÇ`QαÜBO$%ÿÇ╧"$Ç«Ç]É.┬\`%WÉ$  W0 ÄâO0]αG┬ur╩
  1079. ░£▒
  1080. Q¢ú╔Ç≡°s?`X0╘`@ µWâ@╣aá εdq`¥9?Ç&+o0µyÄΣAÅuV(7P╬±@IdQ╕@Å┤@;Ç▓?Çò│CÇ┤╟╨╡KÇÄ30ⁿφ° ó╬ì+]Ä╦≡     Mö╝σ ²y5<!└▀óâ╝É3~mp    $<╛≤9Æ-2ⁿ≡@T,╞Σa,)Pæ└¥#¼╪Q┤S(¼@Aîa
  1081. ≡╤@Ö²±⌠KëD─┴▒▀0╨Ñ$╩-0 ╨ê*╙▓edm`î=3Kß-10è=≥≤²└£mîjy ÿe²ⁿ╨i╕e▓ΣmαÖ╢C%Ç*ê*0 EátQZ`mÄLP%    °üⁿªüNQ∙  T¿<qtWΩc z░ÅÇñΩçǪçÇ«;└<┐á¼¥. á?<Σscî)áí := 0;
  1082.       end;
  1083.     end;
  1084.   end;
  1085.   WaitToGo;
  1086. end; { UserLineStylePlay }
  1087.  
  1088.  
  1089. procedure SayGoodbye;
  1090. { Say goodbye and then exit the program }
  1091. var
  1092.   ViewInfo : ViewPortType;
  1093. begin
  1094.   MainWindow('');
  1095.   GetViewSettings(ViewInfo);
  1096.   SetTextStyle(TriplexFont, HorizDir, 4);
  1097.   SetTextJustify(CenterText, CenterText);
  1098.   with ViewInfo do
  1099.     OutTextXY((x2-x1) div 2, (y2-y1) div 2, 'That''s all folks!');
  1100.   StatusLine('Press any key to quit...');
  1101.   repeat until KeyPressed;
  1102. end; { SayGoodbye }
  1103.  
  1104.  
  1105. PROCEDURE SelectMode;
  1106. VAR
  1107.     choice1,choice2     : CHAR;
  1108.    xsize,ysize            : WORD;
  1109. BEGIN
  1110.     (* Let's select a mode *)
  1111.     ClrScr;
  1112.     WriteLn('VESADEMO:');
  1113.     WriteLn('1. 256 colors');
  1114.     WriteLn('2. 32768 colors');
  1115.     WriteLn('3. 65536 colors');
  1116.     WriteLn('4. 16777216 colors');
  1117.     WriteLn('Q uit');
  1118.     WriteLn;
  1119.     Write('Your choice: ');
  1120.     REPEAT
  1121.         ReadLn(choice1);
  1122.       IF choice1 <> '1' THEN BEGIN
  1123.           WriteLn('Sorry !');
  1124.          WriteLn('This demo wasn''t written for more as 256 colors !');
  1125.          WriteLn('You would only get a limited impression of the Hi-& TrueColor modes...');
  1126.          WriteLn('Switching to 256 colors.');
  1127.          choice1 := '1';
  1128.       END;
  1129.     UNTIL choice1 IN ['1'..'4','q'];
  1130.     IF choice1 = 'q' THEN Halt;
  1131.  
  1132.     WriteLn;
  1133.     WriteLn;
  1134.     WriteLn('a. 320x200');
  1135.     WriteLn('b. 640x480');
  1136.     WriteLn('c. 800x600');
  1137.     WriteLn('d. 1024x768');
  1138.     WriteLn('e. 1280x1024');
  1139.     WriteLn('Q uit');
  1140.     WriteLn;
  1141.     Write('Your choice: ');
  1142.     REPEAT
  1143.         ReadLn(choice2);
  1144.     UNTIL choice2 IN ['a'..'e','q'];
  1145.     IF choice2 = 'q' THEN Halt;
  1146.  
  1147.     CASE choice2 OF
  1148.         'a' : BEGIN
  1149.             xsize := 320;
  1150.             ysize := 200;
  1151.         END;
  1152.         'b' : BEGIN
  1153.             xsize := 640;
  1154.             ysize := 480;
  1155.         END;
  1156.         'c' : BEGIN
  1157.             xsize := 800;
  1158.             ysize := 600;
  1159.         END;
  1160.         'd' : BEGIN
  1161.             xsize := 1024;
  1162.             ysize := 768;
  1163.         END;
  1164.         'e' : BEGIN
  1165.             xsize := 1280;
  1166.             ysize := 1024;
  1167.         END;
  1168.     END;
  1169.     CASE choice1 OF
  1170.         '1' : mode := FindVesaMode(xsize,ysize,8);
  1171.         '2' : mode := FindVesaMode(xsize,ysize,15);
  1172.         '3' : mode := FindVesaMode(xsize,ysize,16);
  1173.         '4' : mode := FindVesaMode(xsize,ysize,24);
  1174.     END;
  1175.     IF mode = 0 THEN BEGIN
  1176.         WriteLn('No such mode could be found !');
  1177.         WriteLn('Switching to to 320x200.');
  1178.         ReadKey;
  1179.         mode := V320x200x256;
  1180.     END;
  1181. END;
  1182.  
  1183. begin { program body }
  1184.   SelectMode;
  1185.   Initialize;
  1186.   ReportStatus;
  1187.  
  1188. {  AspectRatioPlay; }
  1189.   FillEllipsePlay;
  1190.   SectorPlay;
  1191.   WriteModePlay;
  1192.  
  1193.   ColorPlay;
  1194.   { PalettePlay only intended to work on these drivers: }
  1195.   if (GraphDriver = EGA) or
  1196.       (GraphDriver = EGA64) or
  1197.       (GraphDriver = VGA) then
  1198.      PalettePlay;
  1199.   PutPixelPlay;
  1200. {  PutImagePlay; }
  1201.   RandBarPlay;
  1202.   BarPlay;
  1203.   Bar3DPlay;
  1204.   ArcPlay;
  1205.   CirclePlay;
  1206.   PiePlay;
  1207.   LineToPlay;
  1208.   LineRelPlay;
  1209. {  LineStylePlay; }
  1210. {  UserLineStylePlay; }
  1211.   TextDump;
  1212.   TextPlay;
  1213.   CrtModePlay;
  1214.   FillStylePlay;
  1215.   FillPatternPlay;
  1216.   PolyPlay;
  1217.   SayGoodbye;
  1218. {  CloseGraph; }
  1219.   CloseVesa;
  1220. end.
  1221. ***************************************************
  1222.     '* SHOW D2ROTATE (ABOUT THE ORIGIN)
  1223.     '****************************************************************∞╥≤c≤*φè#^│v/╒:j═φ0t+l▓ô"¬"g└≡?%ªêΣ│H╫½╫╜├¿U'╒⌐⌡ ßV?╩
  1224. ¬ujOΦçEZ1∞▐! ▄B╛Σ8║æ]1GlNÜ┐q▌▓;ô$ΦzE<cª*bEô#ä╧ñÅ"∩─LrdaÖ ╠º╫a^¥£å╬1~)@ëÖMδ╫0═6DäFê¬Çv┼ß╨kæpτ╪É)}ª 1w3╤╧ü⌡¥╓h▓╣≈ïÅaÑ[TⁿHqªÉ╝DKÄ─Y-∞tT╤Θ╨º╟╪.*ÇI9lΦ≈{πτcσ$τπßoFr╪╨∩┼╞╟;O2■e²LÜ4^N|╪½ÅO?╔°FOz`╟╟╟'<>>π$πΘù6·
  1225. Xgî╖│°oîδπGƒd╝▀░?■╪╔_9L ⌡ôⁿq'æO▀ƒn4╔▀╚▄┼3pτ.òO°·}÷╕ⁿ±'æO?ít│!√8ßÑ≤/┐╣p┼≥┘E╦Vox╕cΦé5╟╚º╙$?√$≥ΘZεsî≡åìΓpKù¢ïß X╥ 9╞≈\µk┤O¥_ 5Üö\≤éÄ┌╤A[╤ÿáï┼éNⁿÅu16    g,%hc╙╨cD╨Vï┘R¢öKñR;8εáΣ╢╪ós╤π╡á└èxgzPÄMú╫yαºÉ+σJ¢i+▓â3╥    ═Ñ╙î^ºG▓█πérφçs %#(╗⌠?┼%u8≡6+QÉ))ò)Afw≈╣╪)B&4░åLXV:δät@Å.;5Φf╢Ät┐ΣJ╫─U8úÇ╟éö£╕p╔┴⌠vg╨╬╥é÷╪╣┬ΓI.ç≡^v╤ZΦÇ& ╒┌6ñô6XßNè╡╬E₧Ñ
  1226. kIº╠▄A+╣╥éb²tæ-Y¡½αÑa═uuîÇ╢αêvhuª╡SÅ┤vèùú¥F;p<d⌐/F─d█éT%▓KΦû=q■öI┐ ┐╠6S$▒÷╚ENΩ¥Fû9╔┌R'╝ ╧φ└?g┬j▓0═/b╖₧─mûé╢┌»ÿÄë/·<éò■░╤╟╢├Xσ:╥P3Θ"╬Læsφ░┌öSö!╗¿*mN£WΣÇ£┤~#╗ææ≥RΩóh:à▌.æ≈╕▌v£äàd▒à╒├=░╖π║$howeg*╬    6ù▄ƒô╕φ░Ö╢qΘD>(w@úKεHÆ╛öúΣU
  1227. éÜR╔╤W▄èê 2M%ó.▓SNÖA1ùJE╢║l]▓¿>\%└Å4ßO▄£â⌐& ê/)8vSP▀▓ôⁿææ√ü√ÑÄa⌠â╚4S╓╟P- ?Σá╕▓Næ*q╡UΘ▓≈^ñ·I.rúR&$Y^╚%è≡B┌≈Ceat
  1228.     Color := RandColor;
  1229.     SetColor(Color);
  1230.     SetFillStyle(Random(CloseDotFill)+1, Color);
  1231.     Bar3D(Random(MaxWidth), Random(MaxHeight),
  1232.           Random(MaxWidth), Random(MaxHeight), 0, TopOff);
  1233.   until KeyPressed;
  1234.   WaitToGo;
  1235. end; { RandBarPlay }
  1236.  
  1237. procedure ArcPlay;
  1238. { Draw random arcs on the screen }
  1239. var
  1240.   MaxRadius : word;
  1241.   EndAngle : word;
  1242.   ArcInfo : ArcCoordsType;
  1243. begin
  1244.   MainWindow('Arc / GetArcCoords demonstration');
  1245.   StatusLine('Esc aborts or press a key');
  1246.   MaxRadius := MaxY div 10;
  1247.   repeat
  1248.     SetColor(RandColor);
  1249.     EndAngle := Random(360);
  1250.     SetLineStyle(SolidLn, 0, NormWidth);
  1251.     Arc(Random(MaxX), Random(MaxY), Random(EndAngle), EndAngle, Random(MaxRadius));
  1252.     GetArcCoords(ArcInfo);
  1253.     with ArcInfo do
  1254.     begin
  1255.       Line(X, Y, XStart, YStart);
  1256.       Line(X, Y, Xend, Yend);
  1257.     end;
  1258.   until KeyPressed;
  1259.   WaitToGo;
  1260. end; { ArcPlay }
  1261.  
  1262. procedure PutPixelPlay;
  1263. { Demonstrate the PutPixel and GetPixel commands }
  1264. const
  1265.   Seed   = 1962; { A seed for the random number generator }
  1266.   NumPts = 2000; { The number of pixels plotted }
  1267.   Esc    = #27;
  1268. var
  1269.   I : word;
  1270.   X, Y, Color : word;
  1271.   XMax, YMax  : integer;
  1272.   ViewInfo    : ViewPortType;
  1273. begin
  1274.   MainWindow('PutPixel / GetPixel demonstration');
  1275.   StatusLine('Esc aborts or press a key...');
  1276.  
  1277.   GetViewSettings(ViewInfo);
  1278.   with ViewInfo do
  1279.   begin
  1280.     XMax := (x2-x1-1);
  1281.     YMax := (y2-y1-1);
  1282.   end;
  1283.  
  1284.   while not KeyPressed do
  1285.   begin
  1286.     { Plot random pixels }
  1287.     RandSeed := Seed;
  1288.     I := 0;
  1289.     while (not KeyPressed) and (I < NumPts) do
  1290.     begin
  1291.       Inc(I);
  1292.         PutPixel(Random(XMax)+1, Random(YMax)+1, RandColor);
  1293.     end;
  1294.  
  1295.     { Erase pixels }
  1296.     RandSeed := Seed;
  1297.     I := 0;
  1298.     while (not KeyPressed) and (I < NumPts) do
  1299.     begin
  1300.       Inc(I);
  1301.       X := Random(XMax)+1;
  1302.       Y := Random(YMax)+1;
  1303.       Color := GetPixel(X, Y);
  1304.         if Color = RandColor then
  1305.           PutPixel(X, Y, 0);
  1306.      end;
  1307.   end;
  1308.   WaitToGo;
  1309. end; { PutPixelPlay }
  1310.  
  1311. procedure PutImagePlay;
  1312. { Demonstrate the GetImage and PutImage commands }
  1313.  
  1314. const
  1315.   r  = 20;
  1316.   StartX = 100;
  1317.   StartY = 50;
  1318.  
  1319. var
  1320.   CurPort : ViewPortType;
  1321.  
  1322. procedure MoveSaucer(var X, Y : integer; Width, Height : integer);
  1323. var
  1324.   Step : integer;
  1325. begin
  1326.   Step := Random(2*r);
  1327.   if Odd(Step) then
  1328.     Step := -Step;
  1329.   X := X + Step;
  1330.   Step := Random(r);
  1331.   if Odd(Step) then
  1332.     Step := -Step;
  1333.   Y := Y + Step;
  1334.  
  1335.   { Make saucer bounce off viewport walls }
  1336.   with CurPort do
  1337.   begin
  1338.     if (x1 + X + Width - 1 > x2) then
  1339.       X := x2-x1 - Width + 1
  1340.     else
  1341.       if (X < 0) then
  1342.         X := 0;
  1343.     if (y1 + Y + Height - 1 > y2) then
  1344.       Y := y2-y1 - Height + 1
  1345.     else
  1346.       if (Y < 0) then
  1347.         Y := 0;
  1348.   end;
  1349. end; { MoveSaucer }
  1350.  
  1351. var
  1352.   Pausetime : word;
  1353.   Saucer    : pointer;
  1354.   X, Y      : integer;
  1355.   ulx, uly  : word;
  1356.   lrx, lry  : word;
  1357.   Size      : word;
  1358.   I         : word;
  1359. begin
  1360.   ClearDevice;
  1361.   FullPort;
  1362.  
  1363.   { PaintScreen }
  1364.   ClearDevice;
  1365.   MainWindow('GetImage / PutImage Demonstration');
  1366.   StatusLine('Esc aborts or press a key...');
  1367.   GetViewSettings(CurPort);
  1368.  
  1369.   { DrawSaucer }
  1370.   Ellipse(StartX, StartY, 0, 360, r, (r div 3)+2);
  1371.   Ellipse(StartX, StartY-4, 190, 357, r, r div 3);
  1372.   Line(StartX+7, StartY-6, StartX+10, StartY-12);
  1373.   Circle(StartX+10, StartY-12, 2);
  1374.   Line(StartX-7, StartY-6, StartX-10, StartY-12);
  1375.   Circle(StartX-10, StartY-12, 2);
  1376.   SetFillStyle(SolidFill, MaxColor);
  1377.   FloodFill(StartX+1, StartY+4, GetColor);
  1378.  
  1379.   { ReadSaucerImage }
  1380.   ulx := StartX-(r+1);
  1381.   uly := StartY-14;
  1382.   lrx := StartX+(r+1);
  1383.   lry := StartY+(r div 3)+3;
  1384.  
  1385.   Size := ImageSize(ulx, uly, lrx, lry);
  1386.   GetMem(Saucer, Size);
  1387.   GetImage(ulx, uly, lrx, lry, Saucer^);
  1388. {  PutImage(ulx, uly, Saucer^, XORput);               { erase image }
  1389.  
  1390.   { Plot some "stars" }
  1391.   for I := 1 to 1000 do
  1392.      PutPixel(Random(MaxX), Random(MaxY), RandColor);
  1393.   X := MaxX div 2;
  1394.   Y := MaxY div 2;
  1395.   PauseTime := 70;
  1396.  
  1397.   { Move the saucer around }
  1398.   repeat
  1399. {     PutImage(X, Y, Saucer^, XORput);                 { draw image }
  1400.      Delay(PauseTime);
  1401. {     PutImage(X, Y, Saucer^, XORput);                 { erase image }
  1402.      MoveSaucer(X, Y, lrx - ulx + 1, lry - uly + 1);  { width/height }
  1403.   until KeyPressed;
  1404.   FreeMem(Saucer, size);
  1405.   WaitToGo;
  1406. end; { PutImagePlay }
  1407.  
  1408. procedure PolyPlay;
  1409. { Draw random polygons with random fill styles on the screen }
  1410. const
  1411.   MaxPts = 5;
  1412. type
  1413.   PolygonType = array[1..MaxPts] of PointType;
  1414. var
  1415.   Poly : PolygonType;
  1416.   I, Color : word;
  1417. begin
  1418.   MainWindow('FillPoly demonstration');
  1419.   StatusLine('Esc aborts or press a key...');
  1420.   repeat
  1421.     Color := RandColor;
  1422.     SetFillStyle(Random(11)+1, Color);
  1423.     SetColor(Color);
  1424.     for I := 1 to MaxPts do
  1425.       with Poly[I] do
  1426.       begin
  1427.         X := Random(MaxX);
  1428.         Y := Random(MaxY);
  1429.       end;
  1430.     FillPoly(MaxPts, Poly);
  1431.   until KeyPressed;
  1432.   WaitToGo;
  1433. end; { PolyPlay }
  1434.  
  1435. procedure FillStylePlay;
  1436. { Display all of the predefined fill styles available }
  1437. var
  1438.   Style    : word;
  1439.   Width    : word;
  1440.   Height   : word;
  1441.   X, Y     : word;
  1442.   I, J     : word;
  1443.   ViewInfo : ViewPortType;
  1444.  
  1445. procedure DrawBox(X, Y : word);
  1446. begin
  1447.   SetFillStyle(Style, MaxColor);
  1448.   with ViewInfo do
  1449.     Bar(X, Y, X+Width, Y+Height);
  1450.   Rectangle(X, Y, X+Width, Y+Height);
  1451.   OutTextXY(X+(Width div 2), Y+Height+4, Int2Str(Style));
  1452.   Inc(Style);
  1453. end; { DrawBox }
  1454.  
  1455. begin
  1456.   MainWindow('Pre-defined fill styles');
  1457.   GetViewSettings(ViewInfo);
  1458.   with ViewInfo do
  1459.   begin
  1460.     Width := 2 * ((x2+1) div 13);
  1461.     Height := 2 * ((y2-10) div 10);
  1462.   end;
  1463.   X := Width div 2;
  1464.   Y := Height div 2;
  1465.   Style := 0;
  1466.   for J := 1 to 3 do
  1467.   begin
  1468.     for I := 1 to 4 do
  1469.     begin
  1470.       DrawBox(X, Y);
  1471.       Inc(X, (Width div 2) * 3);
  1472.     end;
  1473.     X := Width div 2;
  1474.     Inc(Y, (Height div 2) * 3);
  1475.   end;
  1476.   SetTextJustify(LeftText, TopText);
  1477.   WaitToGo;
  1478. end; { FillStylePlay }
  1479.  
  1480. procedure FillPatternPlay;
  1481. { Display some user defined fill patterns }
  1482. const
  1483.   Patterns : array[0..11] of FillPatternType = (
  1484.   ($AA, $55, $AA, $55, $AA, $55, $AA, $55 üÖü üÖü  !BBäx!!!BBäx!BBäx"""DDêp""DDêp>"""BBääêp""!"BDäêêp>IÉÆ|      ° @≥î>00>><Dêx  !BBäx""DDêp&<"DDêê&22TTêêê$> $< @äêp>          ⁿBBBB<  @@Ç****DDDDDDDU¬U¬U¬U¬U¬U¬U¬▌w▌w▌w▌w▌w▌w▌w°°°≥■°°≥≥■≥≥■■°°°    ≤  ≤  ≤≤         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       ;DDD;    $"Bdÿ>@@@>||>Ac]AAA1N"A""2,  `1NA"*III*<Bü üB<<BüüüB<A" \"QIE" < <BBBB  @@    ~ ?  @ÇB$$B ""A$$"AII6 üBr»$**IIII**ccregion.  The region is defined as any pixel of
  1485.             OldColor which has a path of pixels of OldColor or NewColor
  1486.             with sides touching back to the seed point, (XSeed, YSeed).
  1487.             Therefore, only pixels of OldColor are modified and no other
  1488.             information is ch